﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Graph
{
    public class Vertex
    {
        private string _name;
        private bool _mark;
        private List<Edge> _edgeList;

        public Vertex(string name)
        {
            _mark = false;
            this._name = name;
            _edgeList = new List<Edge>();
        }
        public override string ToString()
        {
            return Name + "  " + Mark;
        }

        public string Name
        {
            get
            {
                return _name;
            }
            set
            {
                _name = value;
            }
        }

        public bool Mark
        {
            get
            {
                return _mark;
            }
            set
            {
                _mark = value;
            }
        }

        public List<Edge> edges()
        {
            return _edgeList;
        }

        public void AddEdge(Vertex to)
        {
            Edge e = new Edge(this, to);
            _edgeList.Add(e);
        }

        public void RemoveEdge(Edge e)
        {
            _edgeList.Remove(e);
        }

        public int OutDegree()
        {
            return _edgeList.Count;
        }
    }
}
